package com.ruoyi.bizsys.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.concurrent.CountDownLatch;

import com.ruoyi.common.core.domain.BaseEntity;
import lombok.NoArgsConstructor;

/**
 * 【请填写功能名称】对象 app_user_mark
 *
 * @author african-loan
 * @date 2022-02-17
 */

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AppUserMark extends BaseEntity {
    private static final long serialVersionUID = 1L;


    /**
     * $column.columnComment
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    @TableId(type = IdType.AUTO)
    private Long id;


    /**
     * userId
     */

    @Excel(name = "userId")
    private String userId;


    /**
     * CustNo
     */

    @Excel(name = "CustNo")
    private String custNo;


    /**
     * 一级标签
     */
    private String firstTag;


    /**
     * 二级标签
     */

    @Excel(name = "二级标签")
    private String secondTag;


    /**
     * 注册手机号
     */

    @Excel(name = "注册手机号")
    private String registerPhone;


    /**
     * 实名lastName
     */

    @Excel(name = "实名lastName")
    private String lastName;


    /**
     * 实名bvn手机号
     */

    @Excel(name = "实名bvn手机号")
    private String bvnPhone;


    /**
     * 生日
     */

    @Excel(name = "生日")
    private String birthday;


    /**
     * 性别
     */

    @Excel(name = "性别")
    private String gender;


    /**
     * 卡号
     */

    @Excel(name = "卡号")
    private String cardNumber;


    /**
     * 授信额度
     */

    @Excel(name = "授信额度")
    private BigDecimal creditLine;


    /**
     * 在贷额度
     */

    @Excel(name = "在贷额度")
    private BigDecimal loanQuota;


    /**
     * 提额额度
     */

    @Excel(name = "提额额度")
    private BigDecimal increasedAmt;


    /**
     * $column.columnComment
     */

    @Excel(name = "备注")
    private String remark;


    /**
     * $column.columnComment
     */

    @Excel(name = "创建人")
    private String createBy;


    /**
     * $column.columnComment
     */

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date createTime;


    /**
     * $column.columnComment
     */

    @Excel(name = "更新时间")
    private String updateBy;


    /**
     * $column.columnComment
     */

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date updateTime;

    /**
     * 提额时间
     */
    private Date increasedCreateTime;


    /**
     * 用户等级
     */
    private String creditRating;

    /**
     * 用户版本
     */
    private String appVersion;

    // volatile 不保证原子性
    private volatile static int num = 0;

    public static void add() {
        num++;
    }

    public static void main(String[] args) throws InterruptedException {
        //理论上num结果应该为 2 万

        CountDownLatch countDownLatch = new CountDownLatch(20);
        for (int i = 1; i <= 20; i++) {
            new Thread(() -> {
                countDownLatch.countDown();
                for (int j = 0; j < 1000; j++) {
                    add();
                }
            }).start();
        }
        countDownLatch.await();

        System.out.println(Thread.currentThread().getName() + " " + num);
    }


}